home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / DJGPP / LGP250S1.ZIP / src / libgplus.5 / include / ieee-flo.h < prev    next >
C/C++ Source or Header  |  1993-03-18  |  2KB  |  66 lines

  1. /* IEEE floating point support declarations, for GDB, the GNU Debugger.
  2.    Copyright (C) 1991 Free Software Foundation, Inc.
  3.  
  4. This file is part of GDB.
  5.  
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. #if !defined (IEEE_FLOAT_H)
  21. #define IEEE_FLOAT_H 1
  22.  
  23. #include "ansidecl.h"
  24.  
  25. /* Parameters for extended float format:  */
  26.  
  27. struct ext_format {
  28.   unsigned totalsize;        /* Total size of extended number */
  29.   unsigned signbyte;        /* Byte number of sign bit */
  30.   unsigned char signmask;    /* Mask for sign bit */
  31.   unsigned expbyte_h;        /* High byte of exponent */
  32.   unsigned expbyte_l;        /* Low  byte of exponent */
  33.   unsigned manbyte_h;        /* High byte of mantissa */
  34.   unsigned manbyte_l;        /* Low  byte of mantissa */
  35. };
  36.  
  37. #define    TOTALSIZE    ext_format->totalsize
  38. #define    SIGNBYTE    ext_format->signbyte
  39. #define    SIGNMASK    ext_format->signmask
  40. #define EXPBYTE_H    ext_format->expbyte_h
  41. #define EXPBYTE_L    ext_format->expbyte_l
  42. #define    MANBYTE_H    ext_format->manbyte_h
  43. #define    MANBYTE_L    ext_format->manbyte_l
  44.  
  45. /* Actual ext_format structs for various machines are in the *-tdep.c file
  46.    for each machine.  */
  47.  
  48. #define    EXT_EXP_NAN    0x7FFF    /* Exponent value that indicates NaN */
  49. #define    EXT_EXP_BIAS    0x3FFF    /* Amount added to "true" exponent for ext */
  50. #define    DBL_EXP_BIAS     0x3FF    /* Ditto, for doubles */
  51.  
  52. /* Convert an IEEE extended float to a double.
  53.    FROM is the address of the extended float.
  54.    Store the double in *TO.  */
  55.  
  56. extern void
  57. ieee_extended_to_double PARAMS ((const struct ext_format *, char *, double *));
  58.  
  59. /* The converse: convert the double *FROM to an extended float
  60.    and store where TO points.  */
  61.  
  62. extern void
  63. double_to_ieee_extended PARAMS ((const struct ext_format *, double *, char *));
  64.  
  65. #endif    /* defined (IEEE_FLOAT_H) */
  66.